package models

import (
	"github.com/ntt360/pmon2/app/model"
	"os"
	"time"
)

type Ext struct {
	SysCtr    bool   `json:"sys_ctr" form:"sys_ctr"`
	SysBuild  bool   `json:"sys_build" form:"sys_build"`
	UploadDir string `json:"upload_dir" form:"upload_dir"  binding:"required"`
	ExtToDir  string `json:"ext_to_dir" form:"ext_to_dir"  binding:"required"`
	Beforce   string `json:"beforce" form:"beforce"`
	After     string `json:"after" form:"after"`
	Desc      string `json:"desc" json:"desc"`
	Id        int    `gorm:"primary_key" json:"id" form:"id"`
}
type Task struct {
	model.ExecFlags
	Ext
}

func (Task) TableName() string {
	return "task"
}

type Task1 struct {
	Id          uint        `json:"id" form:"id"  binding:"required"`
	CreatedAt   time.Time   `json:"created_at"`
	UpdatedAt   time.Time   `json:"updated_at"`
	DeletedAt   *time.Time  `sql:"index" json:"deleted_at"`
	Pid         int         `gorm:"column:pid" json:"pid" form:"pid" `
	Log         string      `gorm:"column:log" json:"log" form:"log"`
	Name        string      `json:"name" form:"name"  binding:"required"`
	ProcessFile string      `json:"process_file" form:"process_file"  binding:"required"`
	Args        string      `json:"args" form:"args"`
	Status      string      `json:"status" form:"status"`
	Pointer     *os.Process `gorm:"-" form:"-"`
	AutoRestart bool        `json:"auto_restart" form:"auto_restart"`
	Uid         string      `json:"uid" form:"uid"`
	Username    string      `json:"username" form:"username"`
	Gid         string      `json:"gid" form:"gid"`
	Ext
}
